package service.imppl;

import dao.IStaffManagementDao;
import dao.impl.StaffManagementDao;
import pojo.Employees;
import service.IStaffManagementService;
import util.PageHelper;

import java.util.ArrayList;

public class StaffManagementService implements IStaffManagementService {
    private IStaffManagementDao ismd=new StaffManagementDao();
    //员工管理
    //员工信息添加(参数为员工对象)
    @Override
    public boolean addStaff(Employees employees) {
        return ismd.insertStaff(employees)>0;
    }
    //单人员工信息查看
    @Override
    public Employees queryStaff(Integer eId) {
        return ismd.selectStaff(eId).get(0);
    }
    //员工信息修改(根据员工对象)
    @Override
    public boolean changeStaff(Employees employees) {
        return ismd.updateStaff(employees)>0;
    }
    // 员工信息列表查看(带分页)
    @Override
    public ArrayList<Employees> queryStaffs(Employees employees, PageHelper pageHelper) {
        // 先获取总记录数
        return ismd.selectStaffs(employees, pageHelper);
    }
    //员工信息数量查询
    @Override
    public int queryCountStaff(Employees employees) {
        return ismd.getTotalCount(employees);
    }

    //员工信息删除(根据员工ID)
    @Override
    public boolean removeStaff(Integer eId) {
        return ismd.delStaff(eId)>0;
    }
}
